<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Item extends Model {
	public static $rules = [
		'name' => 'required|max:16',
		'url' => 'sometimes|max:60',
		'role' => 'required|max:12',
		'discription' => 'required|max:1600',
		'harvest' => 'sometimes|max:300',
		'startDate' => 'required|integer:10',
		'endDate' => 'required|integer:10',
	];
	public static $message = [
		'name.required' => '项目名称不能为空',
		'name.max' => '项目名称最多16个字符',
		'url.max' => '项目URL最多60个字符',
		'role.required' => '项目角色不能为空',
		'role.max' => '项目角色最多12个字符',
		'discription.required' => '项目描述不能为空',
		'discription.max' => '项目描述最多1600个字符',
		'harvest.max' => '项目业绩最多300个字符',
		'startDate.required' => '项目开始时间不能为空',
		'startDate.integer' => '项目开始时间格式不正确',
		'endDate.required' => '项目结束时间不能为空',
		'endDate.integer' => '项目结束时间格式不正确',
	];
	protected function getDateFormat() {
		return time();
	}
	protected function checkUrl() {
		return true;
	}
	protected $fillable = ['resume_id', 'role', 'name', 'url', 'discription', 'content', 'harvest', 'start_date', 'end_date'];
}
